-
Notifications
You must be signed in to change notification settings - Fork 204
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix #2550, use resourceids for internal table validation and dump control blocks #2551
Conversation
if (CFE_TBL_DumpCtrlBlockIsUsed(DumpCtrlPtr) && | ||
CFE_RESOURCEID_TEST_EQUAL(DumpCtrlPtr->RegRecPtr->OwnerAppId, AppId)) |
Check warning
Code scanning / CodeQL
Side effect in a Boolean expression Warning
if (CFE_TBL_Global.DumpControlBlocks[i].State == CFE_TBL_DUMP_PERFORMED) | ||
DumpCtrlPtr = &CFE_TBL_Global.DumpCtrlsJPHFIX[i]; | ||
|
||
if (CFE_TBL_DumpCtrlBlockIsUsed(DumpCtrlPtr) && DumpCtrlPtr->State == CFE_TBL_DUMP_PERFORMED) |
Check warning
Code scanning / CodeQL
Side effect in a Boolean expression Warning
* See description in header file for argument/return detail | ||
* | ||
*-----------------------------------------------------------------*/ | ||
CFE_TBL_ValidationResult_t *CFE_TBL_CheckValidationRequest(CFE_TBL_ValidationResultId_t *ValIdPtr) |
Check notice
Code scanning / CodeQL
Long function without assertion Note
/* | ||
* Tests the resource accessors for Validation Results | ||
*/ | ||
void Test_CFE_TBL_ResourceID_ValidationResult(void) |
Check notice
Code scanning / CodeQL
Long function without assertion Note
memset(ValResultPtr, 0, sizeof(*ValResultPtr)); | ||
} | ||
|
||
void UT_TBL_SetupPendingDump(uint32 ArrayIndex, CFE_TBL_LoadBuff_t *DumpBufferPtr, CFE_TBL_RegistryRec_t *RegRecPtr, |
Check notice
Code scanning / CodeQL
Long function without assertion Note
@@ -113,6 +113,92 @@ | |||
} | |||
} | |||
|
|||
/* Sets up the indicated validation request/result buffer as VALIDATION_PENDING */ | |||
void UT_TBL_SetupPendingValidation(uint32 ArrayIndex, bool UseActive, CFE_TBL_RegistryRec_t *RegRecPtr, |
Check notice
Code scanning / CodeQL
Long function without assertion Note
/* Call the Application's Validation function for the static buffer */ | ||
Status = (RegRecPtr->ValidationFuncPtr)(RegRecPtr->Buffers[0].BufferPtr); | ||
/* Save the result of the Validation function for the Table Services Task */ | ||
ResultPtr->Result = (RegRecPtr->ValidationFuncPtr)(BuffPtr->BufferPtr); |
Check notice
Code scanning / CodeQL
Use of non-constant function pointer Note
@@ -57,7 +57,7 @@ | |||
* \param AccDescPtr Pointer to the current access descriptor | |||
* \param Arg Opaque argument from caller (passed through) | |||
*/ | |||
typedef void (* const CFE_TBL_AccessDescFunc_t)(CFE_TBL_AccessDescriptor_t *AccDescPtr, void *Arg); | |||
typedef void (*const CFE_TBL_AccessDescFunc_t)(CFE_TBL_AccessDescriptor_t *AccDescPtr, void *Arg); |
Check notice
Code scanning / CodeQL
Hidden pointer indirection Note
ff5d60d
to
c27f114
Compare
CFE_TBL_ValidationResult_t *ResultPtr; | ||
uint32 Idx; | ||
|
||
if (CFE_TBL_ValidationResultId_ToIndex(ValResultId, &Idx) == CFE_SUCCESS) |
Check warning
Code scanning / CodeQL
Side effect in a Boolean expression Warning
CFE_TBL_DumpControl_t *BlockPtr; | ||
uint32 Idx; | ||
|
||
if (CFE_TBL_DumpCtrlId_ToIndex(BlockId, &Idx) == CFE_SUCCESS) |
Check warning
Code scanning / CodeQL
Side effect in a Boolean expression Warning
* See description in header file for argument/return detail | ||
* | ||
*-----------------------------------------------------------------*/ | ||
CFE_TBL_ValidationResult_t *CFE_TBL_LocateValidationResultByID(CFE_TBL_ValidationResultId_t ValResultId) |
Check notice
Code scanning / CodeQL
Long function without assertion Note
DumpCtrlPtr->State = CFE_TBL_DUMP_PENDING; | ||
DumpCtrlPtr->BlockId = CFE_TBL_DUMPCTRLID_C(PendingId); | ||
DumpCtrlPtr->RegRecPtr = RegRecPtr; | ||
DumpCtrlPtr->DumpBufferPtr = DumpBufferPtr; |
Check warning
Code scanning / CodeQL
Local variable address stored in non-local memory Warning
parameter
c27f114
to
1319746
Compare
Use a resourceID value for access into the validation result structure array. This allows for consistent lookup, matching, and free/in-use determination, as well as improved resilience to race conditions and stale data.
Use a resourceID value for access into the dump control structure array. This allows for consistent lookup, matching, and free/in-use determination, as well as improved resilience to race conditions and stale data.
1319746
to
b906671
Compare
CCB 25 April 2024: Will review next week when @jphickey is back. |
CCB 2 May 2024: Approved pending BVT run. |
*Combines:* cFE equuleus-rc1+dev141 osal equuleus-rc1+dev66 PSP equuleus-rc1+dev42 **Includes:** *cFS* - #751 - #762 *cFE* - nasa/cFE#2537 - nasa/cFE#2381 - nasa/cFE#2551 *osal* - nasa/osal#1460 *PSP* - nasa/PSP#430 Co-authored by: Justin Figueroa <[email protected]> Co-authored by: Joseph Hickey <[email protected]>
Checklist (Please check before submitting)
Describe the contribution
Use a resourceID value for access into the dump control and validation result structure arrays. This allows for consistent lookup, matching, and free/in-use determination, as well as improved resilience to race conditions and stale data.
Fixes #2550
Testing performed
Build and run all tests, including functional and coverage. Sanity check all results.
Expected behavior changes
No externally visible changes, but API calls and external commands may be more strict about commands they accept/reject due to extra validation checking.
System(s) tested on
Debian
Additional context
Registry records will also be converted to use similar patterns, as a separate commit/PR.
Contributor Info - All information REQUIRED for consideration of pull request
Joseph Hickey, Vantage Systems, Inc.